home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Milan_1991 / Devcon91.4 / AppShell / include / libraries / appshell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-01  |  27.7 KB  |  647 lines

  1. #ifndef LIBRARIES_APPSHELL_H
  2. #define    LIBRARIES_APPSHELL_H
  3.  
  4. /************************************************************************
  5.  *                                                                      *
  6.  *                            Preliminary                               *
  7.  *                        Amiga AppShell (tm)                           *
  8.  *                                                                      *
  9.  *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
  10.  *                                                                      *
  11.  *   This software and information is proprietary, preliminary, and     *
  12.  *   subject to change without notice.                                  *
  13.  *                                                                      *
  14.  *                            DISCLAIMER                                *
  15.  *                                                                      *
  16.  *   THIS SOFTWARE IS PROVIDED "AS IS".                                 *
  17.  *   NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE      *
  18.  *   ACCURACY, RELIABILITY, PERFORMANCE, CURRENTNESS, OR OPERATION      *
  19.  *   OF THIS SOFTWARE, AND ALL USE IS AT YOUR OWN RISK.                 *
  20.  *   NEITHER COMMODORE NOR THE AUTHORS ASSUME ANY RESPONSIBILITY OR     *
  21.  *   LIABILITY WHATSOEVER WITH RESPECT TO YOUR USE OF THIS SOFTWARE.    *
  22.  *                                                                      *
  23.  *                          Non-Disclosure                              *
  24.  *                                                                      *
  25.  *   This information is not to be disclosed to any other company,      *
  26.  *   individual or party.  Discussion is to be restricted to CBM        *
  27.  *   approved discussion areas, such as a private area on bix           *
  28.  *   dedicated to BETA versions of the Amiga AppShell.                  *
  29.  *                                                                      *
  30.  ************************************************************************
  31.  * appshell.h
  32.  * Copyright (C) 1990 Commodore-Amiga, Inc.
  33.  * written by David N. Junod
  34.  *
  35.  * header file for the Amiga AppShell
  36.  *
  37.  */
  38.  
  39. #include <exec/types.h>
  40. #include <exec/nodes.h>
  41. #include <exec/lists.h>
  42. #include <exec/semaphores.h>
  43. #include <intuition/intuition.h>
  44. #include <intuition/screens.h>
  45. #include <dos/dos.h>
  46. #include <dos/dosextens.h>
  47. #include <dos/rdargs.h>
  48. #include <dos/dosasl.h>
  49.  
  50. #ifndef LIBRARIES_APPOBJECTS_H
  51. #include <libraries/appobjects.h>
  52. #endif
  53.  
  54. #ifndef LIBRARIES_APSHATTRS_H
  55. #include <libraries/apshattrs.h>
  56. #endif
  57.  
  58. /* Maximum number of arguments in a command string.  Don't bother changing. */
  59. #define    MAXARG 64
  60.  
  61. /* global object flags */
  62. #define    APSHF_OPEN    (1L<<0)    /* object is open/available */
  63. #define    APSHF_DISABLED    (1L<<1)    /* disabled from use */
  64. #define    APSHF_PRIVATE    (1L<<2)    /* can't be called from command line */
  65. #define    APSHF_ALIAS    (1L<<3)    /* aliased object */
  66. #define    APSHF_LOCKON    (1L<<4)    /* object can't be disabled */
  67. #define    APSHF_SYSTEM    (1L<<5)    /* Belongs to AppShell */
  68.  
  69. /* The Funcs structure contains base information for a command.  This
  70.  * information gets translated into a Function Table entry and gets appended
  71.  * to the Function Table list. */
  72. struct Funcs
  73. {
  74.     UBYTE *fe_Name;        /* Name of function */
  75.     VOID (*fe_Func)(struct Hook *, struct AppInfo *, struct AppFunction *);
  76.     ULONG fe_ID;        /* ID of function */
  77.     STRPTR fe_Template;        /* Command template */
  78.     ULONG fe_NumOpts;        /* Number of options */
  79.     ULONG fe_Flags;        /* Status of function */
  80.     ULONG fe_HelpID;        /* index into the the text catalogue for help */
  81.     STRPTR fe_Params;        /* optional parameters for function */
  82.     ULONG *fe_GroupID;        /* ~0 terminated array of group ID's */
  83.     LONG *fe_Options;        /* ReadOnly! ReadArgs */
  84. };
  85.  
  86. /* no internal function defined for event */
  87. #define    NO_FUNCTION    NULL
  88.  
  89. /* The Project structure is used to maintain information on a project set.
  90.  * Project sets are not limited to the main project list, but also include
  91.  * such things as lists of components for a project. */
  92. struct Project
  93. {
  94.     struct List p_ProjList;    /* Project list */
  95.     struct ProjNode *p_CurProj;    /* Current project */
  96.     LONG p_NumProjs;        /* Number of projects */
  97.     LONG p_MaxID;        /* Next available ID */
  98.     LONG p_State;        /* Listview state */
  99.     LONG p_TopView;        /* Listview top line */
  100.     LONG p_CurLine;        /* Listview current line */
  101.     ULONG p_Flags;        /* Project flags */
  102.     APTR p_UserData;        /* User data extension */
  103.     APTR p_SysData;        /* System data extension */
  104. };
  105.  
  106. /* When this flag is set, the project information is being displayed by
  107.  * the Project List data entry requester. */
  108. #define    APSHF_PROJVIEW (1L<<1)
  109.  
  110.  
  111. /* Within the Project structure is an Exec list called p_ProjList.  This
  112.  * is a list of ProjNode structures.  This structure contains information
  113.  * on projects or project components.  This information can be obtained at
  114.  * startup time, from AppWindow/AppIcon messages, ASL file requester or
  115.  * through application constructs. */
  116. struct ProjNode
  117. {
  118.     struct Node pn_Node;    /* embedded Exec node */
  119.  
  120.     /* AppShell information.  Read only for application */
  121.     struct DateStamp pn_Added;    /* date stamp when added to list */
  122.     BPTR pn_ProjDir;        /* lock on project directory */
  123.     STRPTR pn_ProjPath;        /* pointer to the projects' complete name */
  124.     STRPTR pn_ProjName;        /* pointer to the projects' name */
  125.     STRPTR pn_ProjComment;    /* pointer to the projects' comment */
  126.     struct DiskObject *pn_DObj;    /* pointer to the projects' icon */
  127.     LONG pn_ID;            /* user selected order */
  128.     APTR pn_SysData;        /* System data extension */
  129.  
  130.     /* Application information */
  131.     ULONG pn_Status;        /* status of project */
  132.     ULONG pn_ProjID;        /* project ID */
  133.     UBYTE pn_Name[32];        /* project name */
  134.     APTR pn_UserData;        /* UserData for project */
  135.     BOOL pn_Changed;        /* has project been modified? */
  136. };
  137.  
  138. /* AppInfo structure that contains an AppShell application's global
  139.  * variables.  This structure is variable length, so NEVER embedd this
  140.  * within your own structures.  If you must, then reference it by a
  141.  * pointer. */
  142. #ifndef AppInfo
  143. struct AppInfo
  144. {
  145.     /* control information */
  146.     UBYTE *ai_TextRtn;        /* Text return string */
  147.     LONG ai_Pri_Ret;        /* Primary error (severity) */
  148.     LONG ai_Sec_Ret;        /* Secondary error (actual) */
  149.     BOOL ai_Done;        /* Done with main loop? */
  150.  
  151.     /* startup arguments */
  152.     UWORD ai_Startup;        /* see defines below */
  153.     LONG *ai_Options;        /* Option bucket */
  154.     LONG ai_NumOpts;        /* Number of options */
  155.     struct RDArgs *ai_ArgsPtr;    /* ReadArgs pointer */
  156.     STRPTR *ai_FileArray;    /* MultiArg array (from the 0 bucket) */
  157.                 /* If the template specifies FILES/M, then
  158.                  * the array is expanded using pattern
  159.                  * matching and the resulting files are
  160.                  * added to the project list */
  161.     struct DiskObject *ai_ProgDO;/* Tool icon */
  162.  
  163.     /* base application information */
  164.     ULONG ai_Pad1;
  165.     ULONG ad_Pad2;
  166.     BPTR ai_ProgDir;        /* base directory for application */
  167.     BPTR ai_ConfigDir;        /* configuration file directory */
  168.     struct List ai_PrefList;    /* list of preference files */
  169.     STRPTR ai_BaseName;        /* pointer to application base name */
  170.     STRPTR ai_ProgName;        /* pointer to application program name */
  171.     STRPTR ai_AppName;        /* pointer to application name */
  172.     STRPTR ai_AppVersion;    /* pointer to version string */
  173.     STRPTR ai_AppCopyright;    /* pointer to copyright notice */
  174.     STRPTR ai_AppAuthor;    /* pointer to author */
  175.     STRPTR ai_AppMsgTitle;    /* pointer to title for messages */
  176.  
  177.     /* project information */
  178.     struct Project ai_Project;    /* embedded Project structure */
  179.  
  180.     /* application information */
  181.     APTR ai_UserData;        /* UserData */
  182.  
  183.     /* READ ONLY Intuition-specific information */
  184.     STRPTR ai_ScreenName;    /* pointer to public screen name */
  185.     struct Screen *ai_Screen;    /* Active screen */
  186.     struct TextFont *ai_Font;    /* Font for screen */
  187.     struct Window *ai_Window;    /* Active window */
  188.     struct Gadget *ai_Gadget;    /* Active gadget */
  189.     struct MHObject *ai_CurObj;    /* Active object (gadget) */
  190.     struct DrawInfo *ai_DI;    /* Intuition DrawInfo */
  191.     VOID *ai_VI;        /* GadTools VisualInfo */
  192.     WORD ai_MouseX;        /* Position at last IDCMP message */
  193.     WORD ai_MouseY;        /* Position at last IDCMP message */
  194.     UWORD ai_TopLine;        /* top line */
  195.  
  196. /*------------------------------------------------------------------------*/
  197. /* The following fields are not for public consumption                    */
  198. /*------------------------------------------------------------------------*/
  199. };
  200.  
  201. /* AI_FUNCTION */
  202. struct AppFunction
  203. {
  204.     ULONG MethodID;
  205.     STRPTR af_CmdLine;        /* Untouched command line */
  206.     struct TagItem *af_Attrs;    /* Attributes */
  207.     LONG af_Kind;        /* ID of the active message handler */
  208.     struct Message *af_Msg;    /* Pointer to the active message */
  209.     struct Funcs *af_FE;    /* Current function entry */
  210. };
  211.  
  212. #define    AI_FUNCTION    0
  213.  
  214. #endif
  215.  
  216. /* ai_Startup flags */
  217. #define    APSHF_START_WB        (1L<<0)    /* if set then WB, else Shell */
  218. #define    APSHF_START_CLONE    (1L<<1)
  219.  
  220. /* This structure is used to search through a Exec linked list using
  221.  * DOS pattern matching */
  222. struct AnchorList
  223. {
  224.     struct Node *al_CurNode;
  225.     struct Node *al_NxtNode;
  226.     STRPTR al_Token;
  227.     ULONG al_Flags;
  228. };
  229.  
  230. /* Pattern matching is case insensitive */
  231. #define    APSHF_ANCHOR_NOCASE    (1L<<0)
  232. #define    APSHF_ANCHOR_reserved    (1L<<1)
  233.  
  234. /*--------------------------------------------------------------------------*/
  235. /* Following is information used by the main portion of the AppShell        */
  236. /*--------------------------------------------------------------------------*/
  237.  
  238. /* Each message handler gets a base ID from which all of their commands are
  239.  * offset.  The main functions are offset from zero. */
  240. #define APSH_MAIN_ID 0L
  241.  
  242. /* Following are ID's for the functions that are implemented by the AppShell
  243.  * whether there are any message handlers or not. */
  244. #define MAIN_Dummy    APSH_MAIN_ID
  245. #define AliasID        (MAIN_Dummy+1L) /* set up function w/parameters     */
  246. #define DebugID        (MAIN_Dummy+2L) /* general debugging                */
  247. #define DisableID    (MAIN_Dummy+3L) /* Disable a function               */
  248. #define EditID        (MAIN_Dummy+4L) /* Edit an object                   */
  249. #define EnableID    (MAIN_Dummy+5L) /* Enable a function                */
  250. #define ExecMacroID    (MAIN_Dummy+6L) /* Execute the internal macro       */
  251. #define FaultID        (MAIN_Dummy+7L) /* Return error text                */
  252. #define GetID        (MAIN_Dummy+8L) /* Get object attribute             */
  253. #define GroupID        (MAIN_Dummy+9L) /* Maintain object groups           */
  254. #define HelpID        (MAIN_Dummy+10L)/* Help                             */
  255. #define LearnID        (MAIN_Dummy+11L)/* Learn macro function             */
  256. #define StopLearnID    (MAIN_Dummy+12L)/* Stop learn macro function        */
  257. #define LoadMacroID    (MAIN_Dummy+13L)/* Load a macro into the internal memory */
  258. #define PriorityID    (MAIN_Dummy+14L)/* Set an objects priority (process) */
  259. #define    RemoveID    (MAIN_Dummy+15L)/* remove an object (project)       */
  260. #define SaveMacroID    (MAIN_Dummy+16L)/* Save the internal macro to disk  */
  261. #define SelectID    (MAIN_Dummy+17L)/* select an object (project)       */
  262. #define SelectTopID    (MAIN_Dummy+18L)/* select first object (project)    */
  263. #define SelectNextID    (MAIN_Dummy+19L)/* select next object (project)     */
  264. #define SelectPrevID    (MAIN_Dummy+20L)/* select previous object (project) */
  265. #define SelectBottomID    (MAIN_Dummy+21L)/* select last object (project)     */
  266. #define SetID        (MAIN_Dummy+22L)/* Set object attributes            */
  267. #define StatusID    (MAIN_Dummy+23L)/* Give status of an object         */
  268. #define StopID        (MAIN_Dummy+24L)/* Stop an operation                */
  269. #define StubID        (MAIN_Dummy+25L)/* NOP function                     */
  270. #define    VersionID    (MAIN_Dummy+26L)/* Version                          */
  271. #define    SystemID    (MAIN_Dummy+27L)/* Perform AmigaDOS command         */
  272.  
  273. /* data transmission function ID's via OpenSIPC, SIPCPrintf, CloseSIPC */
  274. #define    LoginID        (MAIN_Dummy+100L)/* request data transmission session */
  275. #define    DataStreamID    (MAIN_Dummy+101L)/* data transmission */
  276. #define    SuspendID    (MAIN_Dummy+102L)/* temporarily suspend session */
  277. #define    ResumeID    (MAIN_Dummy+103L)/* resume data session */
  278. #define    LogoutID    (MAIN_Dummy+104L)/* signal end of session */
  279.  
  280. /* Following are ID's for functions that should be implemented by the
  281.  * application to help promote a consistent set of functions for the
  282.  * end user. */
  283.  
  284. /* standard project functions */
  285. #define    NewID        (MAIN_Dummy+500L)/* new project/process */
  286. #define    ClearID        (MAIN_Dummy+501L)/* clear current project */
  287. #define    OpenID        (MAIN_Dummy+502L)/* open an existing project */
  288. #define    SaveID        (MAIN_Dummy+503L)/* save project to existing name */
  289. #define    SaveAsID    (MAIN_Dummy+504L)/* save project to a new name */
  290. #define    RevertID    (MAIN_Dummy+505L)/* revert project to last saved */
  291. #define    PrintID        (MAIN_Dummy+506L)/* print the current project */
  292. #define    PrintAsID    (MAIN_Dummy+507L)/* define print configuration */
  293. #define    AboutID        (MAIN_Dummy+508L)/* display application information */
  294. #define    InfoID        (MAIN_Dummy+509L)/* display project information */
  295. #define    QuitID        (MAIN_Dummy+510L)/* exit from the application */
  296. #define    HideID        (MAIN_Dummy+511L)/* hide the project */
  297. #define    CloseID        (MAIN_Dummy+512L)/* close the project */
  298.  
  299. #define    DropIconID    (MAIN_Dummy+519L)/* icon dropped in window */
  300.  
  301. /* application standard edit functions */
  302. #define    MarkID        (MAIN_Dummy+520L)
  303. #define    CutID        (MAIN_Dummy+521L)
  304. #define    CopyID        (MAIN_Dummy+522L)
  305. #define    PasteID        (MAIN_Dummy+523L)
  306. #define    EraseID        (MAIN_Dummy+524L)
  307. #define    UndoID        (MAIN_Dummy+525L)
  308. #define    OpenClipID    (MAIN_Dummy+526L)
  309. #define    SaveClipID    (MAIN_Dummy+527L)
  310. #define    PrintClipID    (MAIN_Dummy+528L)
  311. #define    ShowClipID    (MAIN_Dummy+529L)
  312.  
  313. /* application standard search functions */
  314. #define    GotoID        (MAIN_Dummy+540L)
  315. #define    FindID        (MAIN_Dummy+541L)
  316. #define    NextID        (MAIN_Dummy+542L)
  317. #define    ReplaceID    (MAIN_Dummy+543L)
  318.  
  319.  
  320. /*--------------------------------------------------------------------------*/
  321. /* Following is information used by the ARexx message handler               */
  322. /*--------------------------------------------------------------------------*/
  323.  
  324. /* ID assigned to the ARexx message handler */
  325. #define APSH_AREXX_ID 5000L
  326.  
  327. /* Following are ID's for the functions that are implemented by the ARexx
  328.  * message handler. */
  329. #define    AREXX_Dummy    APSH_AREXX_ID
  330. #define    RXID        (AREXX_Dummy+1L)/* Execute an ARexx command */
  331. #define    WhyID        (AREXX_Dummy+2L)/* Return information on the last error */
  332. #define    RXSID        (AREXX_Dummy+3L)/* Execute an ARexx string file */
  333.  
  334. /* ID for an ARexx low-level message handler function */
  335. #define    AH_SENDCMD 4
  336.  
  337. /*--------------------------------------------------------------------------*/
  338. /* Following is information used by the Command Shell message handler       */
  339. /*--------------------------------------------------------------------------*/
  340.  
  341. #define    APSH_DOS_ID 6000L
  342. #define    CMDShellID    (APSH_DOS_ID+1L)    /* Activate the Command Shell */
  343.  
  344. /*--------------------------------------------------------------------------*/
  345. /* Following is information used by the Intuition message handler           */
  346. /*--------------------------------------------------------------------------*/
  347.  
  348. /* Make a Window definition without opening it */
  349. #define    APSH_MH_MAKE        4
  350.  
  351. /* Hide a Window */
  352. #define    APSH_MH_HIDE        5
  353.  
  354. #define APSH_IDCMP_ID 7000L
  355. #define    ActivateID    (APSH_IDCMP_ID+1L)    /* Open GUI */
  356. #define    ButtonID    (APSH_IDCMP_ID+2L)    /* Edit gadget */
  357. #define    KeystrokeID    (APSH_IDCMP_ID+3L)    /* Edit keystroke */
  358. #define    MenuID        (APSH_IDCMP_ID+4L)    /* Edit menu */
  359. #define    WindowToFrontID    (APSH_IDCMP_ID+5L)    /* bring current window to front */
  360. #define    WindowToBackID    (APSH_IDCMP_ID+6L)    /* send current window to back */
  361. #define    WindowID    (APSH_IDCMP_ID+7L)    /* open/close window */
  362. #define    DeActivateID    (APSH_IDCMP_ID+8L)    /* Shutdown GUI */
  363. #define    LockGUIID    (APSH_IDCMP_ID+9L)    /* Lock the GUI */
  364. #define    UnLockGUIID    (APSH_IDCMP_ID+10L)    /* Unlock the GUI */
  365.  
  366. /* extended MenuItem structure */
  367. struct EMenuItem
  368. {
  369.     struct MenuItem emi_Item;    /* embedded MenuItem structure */
  370.     ULONG emi_MenuID;        /* ID used for function number to perform */
  371.     APTR emi_UserData;        /* UserData (like other Intuition structs) */
  372. };
  373.  
  374. /*--- KEYBOARD RELATED ITEMS ---*/
  375. #define    SPECIAL 255
  376.  
  377. /* some useful defines */
  378. #define    TAB      9
  379. #define    RETURN  13
  380. #define    ESC    27
  381. #define    DELETE    127
  382. #define    HELP    (SPECIAL+'?')
  383. #define    FUNC1    (SPECIAL+'0')
  384. #define    FUNC2    (SPECIAL+'1')
  385. #define    FUNC3    (SPECIAL+'2')
  386. #define    FUNC4    (SPECIAL+'3')
  387. #define    FUNC5    (SPECIAL+'4')
  388. #define    FUNC6    (SPECIAL+'5')
  389. #define    FUNC7    (SPECIAL+'6')
  390. #define    FUNC8    (SPECIAL+'7')
  391. #define    FUNC9    (SPECIAL+'8')
  392. #define    FUNC10    (SPECIAL+'9')
  393. #define    UP    (SPECIAL+'A')
  394. #define    DOWN    (SPECIAL+'B')
  395. #define    RIGHT    (SPECIAL+'C')
  396. #define    LEFT    (SPECIAL+'D')
  397.  
  398. /* component for our keyboard command array */
  399. struct KeyboardCMD
  400. {
  401.     ULONG kbc_Key;        /* key */
  402.     ULONG kbc_FuncID;        /* function ID */
  403. };
  404.  
  405. /*--------------------------------------------------------------------------*/
  406. /* Following is information used by the Simple IPC message handler          */
  407. /*--------------------------------------------------------------------------*/
  408.  
  409. #define    APSH_SIPC_ID 10000L
  410.  
  411. /* This structure is used by the AppShell to communicate with tools and
  412.  * other AppShell applications.
  413.  *
  414.  * If sipc_DType equal NULL, then the function ID in sipc_Type is performed
  415.  * with no arguments.
  416.  *
  417.  *    PerfFunc (ai, sipc_Type, NULL, NULL);
  418.  *
  419.  * If sipc_DType equal APSH_SDT_TagList, then the function ID in sipc_Type is
  420.  * performed with sipc_Data as the tag list arguments.
  421.  *
  422.  *    PerfFunc (ai, sipc_Type, NULL, sipc_Data);
  423.  *
  424.  * If sipc_DType equal APSH_SDT_Data, then the function ID in sipc_Type is
  425.  * performed with with the following tags as arguments:
  426.  *
  427.  *    APSH_SIPCData,       sipc_Data
  428.  *    APSH_SIPCDataLength, sipc_DSize
  429.  *
  430.  * If sipc_DType equal APSH_SDT_Command, then the string command line
  431.  * passed in the sipc_Data field is performed:
  432.  *
  433.  *    PerfFunc (ai, NULL, sipc_Data, NULL);
  434.  *
  435.  */
  436. struct SIPCMessage
  437. {
  438.     struct Message sipc_Msg;    /* Embedded Exec message structure */
  439.     ULONG sipc_Type;        /* Type of message */
  440.     APTR sipc_Data;        /* Pointer to message data */
  441.     ULONG sipc_DSize;        /* Size of message data */
  442.     ULONG sipc_DType;        /* Type of message data */
  443.     ULONG sipc_Pri_Ret;        /* Primary return value */
  444.     ULONG sipc_Sec_Ret;        /* Secondary return value */
  445.     APTR sipc_Extens1;        /* *** PRIVATE *** SYSTEM USE ONLY! */
  446.     APTR sipc_Extens2;        /* *** PRIVATE *** SYSTEM USE ONLY! */
  447. };
  448.  
  449. /* These flags are used in the sipc_DType field to indicate what type of
  450.  * information is in the sipc_Data field. */
  451. #define    APSH_SDT_Command (1L<<1)/* Data is a STRPTR */
  452. #define    APSH_SDT_TagList (1L<<2)/* Data is a list of TagItem's */
  453. #define    APSH_SDT_Data    (1L<<3)/* Data is a pointer to a data block */
  454. #define    APSH_SDT_Text    (1L<<4)/* text transmissions via sprintf */
  455.  
  456. /* Public SIPC port name given to the AppShell remote debugger.  Accessed
  457.  * using OpenSIPC, SIPCPrintf and CloseSIPC. */
  458. #define    DEBUGGER "AppShell_Debugger"
  459.  
  460. /*--------------------------------------------------------------------------*/
  461. /* Following is information used by the Tool message handler                */
  462. /*--------------------------------------------------------------------------*/
  463.  
  464. #define    APSH_TOOL_ID 11000L
  465. #define    StartupMsgID    (APSH_TOOL_ID+1L)    /* Startup message */
  466. #define    LoginToolID    (APSH_TOOL_ID+2L)    /* Login a tool SIPC port */
  467. #define    LogoutToolID    (APSH_TOOL_ID+3L)    /* Logout a tool SIPC port */
  468. #define    ShutdownMsgID    (APSH_TOOL_ID+4L)    /* Shutdown message */
  469. #define    ActivateToolID    (APSH_TOOL_ID+5L)    /* Activate tool */
  470. #define    DeactivateToolID (APSH_TOOL_ID+6L)    /* Deactivate tool */
  471. #define    ActiveToolID    (APSH_TOOL_ID+7L)    /* Tool Active */
  472. #define    InactiveToolID    (APSH_TOOL_ID+8L)    /* Tool Inactive */
  473. #define    ToolStatusID    (APSH_TOOL_ID+9L)    /* Status message */
  474. #define    ToolCmdID    (APSH_TOOL_ID+10L)    /* Tool command message */
  475. #define    ToolCmdReplyID    (APSH_TOOL_ID+11L)    /* Reply to tool command */
  476. #define    ShutdownToolID    (APSH_TOOL_ID+12L)    /* Shutdown tool */
  477.  
  478. typedef VOID (*F_PTR)(APTR, struct MsgPort *);
  479.  
  480. #define    TOOL_ACTIVATE (1L<<1)
  481.  
  482. /*--------------------------------------------------------------------------*/
  483. /* Following is information used by the Workbench message handler           */
  484. /*--------------------------------------------------------------------------*/
  485.  
  486. #define    APSH_WB_ID 12000L
  487.  
  488. /* APSH_CmdFlags */
  489. #define    APSH_WBF_DISPLAY (1L<<1)    /* maintain display box for icon */
  490. #define    APSH_WBF_PROJLIST (1L<<2)    /* add the WBArgs to the project list */
  491. #define    APSH_WBF_NOLIST (1L<<3)        /* don't add the WBArgs to a list */
  492.  
  493. /*--------------------------------------------------------------------------*/
  494. /* Following is information for use by the Application                      */
  495. /*--------------------------------------------------------------------------*/
  496.  
  497. /* base tag for application functions */
  498. #define    APSH_USER_ID 100000L
  499.  
  500.  
  501. /*--------------------------------------------------------------------------*/
  502. /* Following is low-level message handler information                       */
  503. /*--------------------------------------------------------------------------*/
  504.  
  505. /* message handler object node */
  506. struct MHObject
  507. {
  508.     struct Node mho_Node;    /* embedded Exec node */
  509.     struct List mho_ObjList;    /* embedded List of children objects */
  510.     struct MHObject *mho_Parent;/* pointer to parent object */
  511.     struct MHObject *mho_CurNode;/* pointer to current child object */
  512.     ULONG mho_ID;        /* numeric ID of object */
  513.     ULONG mho_Status;        /* status of object */
  514.     APTR mho_SysData;        /* message handler data */
  515.     APTR mho_UserData;        /* application data */
  516.     APTR mho_Extens1;        /* *** PRIVATE *** */
  517.     UBYTE mho_Name[1];        /* name of object */
  518. };
  519.  
  520. /* message handler node */
  521. struct MsgHandler
  522. {
  523.     struct MHObject mh_Header;    /* embedded MHObject structure */
  524.  
  525.     struct MsgPort *mh_Port;    /* message port for handler */
  526.     STRPTR mh_PortName;        /* port name, if public */
  527.     ULONG mh_SigBits;        /* signal bits to watch for */
  528.  
  529.     /* handler functions */
  530.     WORD mh_NumFuncs;        /* number of functions in handler */
  531.     BOOL (**mh_Func)(struct AppInfo *,struct MsgHandler *,struct TagItem *);
  532.  
  533.     STRPTR *mh_DefText;        /* Default text catalogue */
  534.     APTR mh_Catalogue;        /* *** PRIVATE *** */
  535.  
  536.     LONG mh_Outstanding;    /* Number of outstanding messages */
  537.     APTR mh_Extens2;        /* *** PRIVATE *** */
  538. };
  539.  
  540. /*--- interface function array pointers ---*/
  541. #define    APSH_MH_OPEN        0    /* make a message handler active */
  542. #define    APSH_MH_HANDLE        1    /* handle messages */
  543. #define    APSH_MH_CLOSE        2    /* make a message handler inactive */
  544. #define    APSH_MH_SHUTDOWN    3    /* free resources and delete message handler */
  545.  
  546. /*--- node types ---*/
  547. #define    APSH_MH_HANDLER_T    100    /* message handler node */
  548. #define    APSH_MH_DATA_T        101    /* data node */
  549.  
  550. /*--- message handler object types */
  551. #define    APSH_MHO_WINDOW        110    /* Intuition window */
  552. #define    APSH_MHO_INTOBJ        111    /* AppShell Intuition object */
  553. #define    APSH_MHO_TOOL        120    /* Tool */
  554.  
  555. /*--- node priorities ---*/
  556. #define    APSH_MH_HANDLER_P    10    /* message handler node default priority */
  557. #define    APSH_MH_DATA_P        -10    /* data node default priority */
  558.  
  559. /*--- overall status ---*/
  560. #define    APSHP_INACTIVE        (1L<<1)
  561. #define    APSHP_SINGLE        (1L<<2)
  562. #define    APSH_REQUIRED        TRUE
  563. #define APSH_OPTIONAL        FALSE
  564.  
  565. /*--------------------------------------------------------------------------*/
  566. /* Following are ID's to use to access the AppShell text table              */
  567. /*--------------------------------------------------------------------------*/
  568. #define    APSH_PAD        0L
  569. #define    APSH_NOT_AN_ICON    (APSH_PAD+1L)    /* %s is not an icon. */
  570. #define    APSH_NOT_AVAILABLE    (APSH_PAD+2L)    /* %s is not available */
  571. #define APSH_PORT_ACTIVE    (APSH_PAD+3L)    /* %s port already active */
  572. #define APSH_PORT_X_ACTIVE    (APSH_PAD+4L)    /* port, %s, already active */
  573. #define APSH_NOT_AN_IFF        (APSH_PAD+5L)    /* %s is not an IFF file */
  574. #define APSH_NOT_AN_IFF_X    (APSH_PAD+6L)    /* %1$s is not an IFF %2$s file */
  575. #define APSH_CLOSE_ALL_WINDOWS    (APSH_PAD+7L)    /* Close all windows */
  576. #define APSH_CMDSHELL_PROMPT    (APSH_PAD+8L)    /* Cmd> */
  577. #define APSH_CLDNT_CREATE_X    (APSH_PAD+9L)    /* Could not create %s */
  578. #define APSH_CLDNT_CREATE_PORT    (APSH_PAD+10L)    /* Could not create port, %s */
  579. #define APSH_CLDNT_CREATE_OBJ    (APSH_PAD+11L)    /* Could not create object */
  580. #define APSH_CLDNT_CREATE_OBJ_X    (APSH_PAD+12L)    /* Could not create object, %s */
  581. #define APSH_CLDNT_CREATE_FILE    (APSH_PAD+13L)    /* Could not create file */
  582. #define APSH_CLDNT_CREATE_FILE_X (APSH_PAD+14L)    /* Could not create file, %s */
  583. #define APSH_CLDNT_INIT_X    (APSH_PAD+15L)    /* Could not initialize %s */
  584. #define APSH_CLDNT_INIT_MSGH    (APSH_PAD+16L)    /* Could not initialize %s message handler */
  585. #define APSH_CLDNT_LOCK        (APSH_PAD+17L)    /* Could not lock %s */
  586. #define APSH_CLDNT_LOCK_DIR    (APSH_PAD+18L)    /* Could not lock directory */
  587. #define APSH_CLDNT_LOCK_DIR_X    (APSH_PAD+19L)    /* Could not lock directory, %s */
  588. #define APSH_CLDNT_LOCK_PUB    (APSH_PAD+20L)    /* Could not lock public screen */
  589. #define APSH_CLDNT_LOCK_PUB_X    (APSH_PAD+21L)    /* Could not lock public screen, %s */
  590. #define APSH_CLDNT_OBTAIN    (APSH_PAD+22L)    /* Could not obtain %s */
  591. #define APSH_CLDNT_OPEN        (APSH_PAD+23L)    /* Could not open %s */
  592. #define APSH_CLDNT_OPEN_FILE    (APSH_PAD+24L)    /* Could not open file */
  593. #define APSH_CLDNT_OPEN_FILE_X    (APSH_PAD+25L)    /* Could not open file, %s */
  594. #define APSH_CLDNT_OPEN_FONT_X    (APSH_PAD+26L)    /* Could not open font, %s */
  595. #define APSH_CLDNT_OPEN_MACRO    (APSH_PAD+27L)    /* Could not open macro file, %s */
  596. #define APSH_CLDNT_OPEN_PREF    (APSH_PAD+28L)    /* Could not open preference file, %s */
  597. #define APSH_CLDNT_OPEN_SCREEN    (APSH_PAD+29L)    /* Could not open screen */
  598. #define APSH_CLDNT_OPEN_WINDOW    (APSH_PAD+30L)    /* Could not open window */
  599. #define APSH_SETUP_TIMER    (APSH_PAD+31L)    /* Could not set up timer event */
  600. #define APSH_SETUP_HOTKEYS    (APSH_PAD+32L)    /* Could not set up HotKeys */
  601. #define APSH_START_PROCESS    (APSH_PAD+33L)    /* Could not start process */
  602. #define APSH_START_TOOL        (APSH_PAD+34L)    /* Could not start tool */
  603. #define APSH_START_TOOL_X    (APSH_PAD+35L)    /* Could not start tool, %s */
  604. #define APSH_WRITE_FILE        (APSH_PAD+36L)    /* Could not write to file */
  605. #define APSH_WRITE_FILE_X    (APSH_PAD+37L)    /* Could not write to file, %s */
  606. #define APSH_WRITE_MACRO    (APSH_PAD+38L)    /* Could not write to macro file */
  607. #define APSH_CMDSHELL_WIN    (APSH_PAD+39L)    /* CON:0/150/600/50/Command Shell/CLOSE */
  608. #define APSH_NO_NAMETAG_WIN    (APSH_PAD+40L)    /* No name given for window */
  609. #define APSH_NO_PORT        (APSH_PAD+41L)    /* No port name specified */
  610. #define APSH_NOT_ENOUGH_MEMORY    (APSH_PAD+42L)    /* Not enough memory */
  611. #define APSH_WAITING_FOR_MACRO    (APSH_PAD+43L)    /* Waiting for macro return */
  612. #define APSH_DISABLED        (APSH_PAD+44L)    /* %s is disabled */
  613. #define APSH_IOERR        (APSH_PAD+45L)    /* IoErr #%ld */
  614. #define APSH_INVALID_NAMETAG    (APSH_PAD+46L)    /* Invalid name tag. */
  615. #define APSH_OKAY_TXT        (APSH_PAD+47L)    /* Okay */
  616. #define APSH_CANCEL_TXT        (APSH_PAD+48L)    /* Cancel */
  617. #define APSH_CONTINUE_TXT    (APSH_PAD+49L)    /* Continue */
  618. #define APSH_DONE_TXT        (APSH_PAD+50L)    /* Done */
  619. #define APSH_ABORT_TXT        (APSH_PAD+51L)    /* Abort */
  620. #define APSH_QUIT_TXT        (APSH_PAD+52L)    /* Quit */
  621. #define APSH_UNNAMED        (APSH_PAD+53L)    /* Unnamed */
  622. #define APSH_SYNTAX_ERROR    (APSH_PAD+54L)    /* Syntax Error:\n%s %s */
  623. #define    APSH_UNKNOWN_COMMAND    (APSH_PAD+55L)    /* Unknown command */
  624. #define    APSH_CMDSHELL_TITLE    (APSH_PAD+56L)    /* Command shell title */
  625. #define    APSH_USER_ABORTED    (APSH_PAD+57L)    /* User request aborted */
  626. #define APSH_LAST_MESSAGE    (APSH_PAD+58L)    /* Last error message */
  627.  
  628. /* Usually allocate one large block of memory for a group of items and then
  629.  * divy out to the appropriate pointers.  Use with caution---must be
  630.  * consistent with field types! */
  631. #ifndef MEMORY_FOLLOWING
  632. #define MEMORY_FOLLOWING(ptr) ((void *)((ptr)+1))
  633. #define MEMORY_N_FOLLOWING(ptr,n)  ((void *)( ((ULONG)ptr) + n ))
  634. #endif
  635.  
  636. /* Used to cast an pointer to a void pointer */
  637. #ifndef V
  638. #define V(x) ((void *)x)
  639. #endif
  640.  
  641. /* BPTR compatibility */
  642. #ifndef TO_BPTR
  643. #define TO_BPTR(x) ((BPTR)(((ULONG)(x)) >> 2))
  644. #endif
  645.  
  646. #endif /* LIBRARIES_APPSHELL_H */
  647.